import server from '../index.js'

function post(path, auth = true, config = true) {
  return server.api().post(path).auth(auth).config(config)
}

function get(path, auth = true, config = true) {
  return server.api().get(path).auth(auth).config(config)
}

export default {
  unloadImg: () => server.api().upload('/dt-tool/api/v1/vod/uploadImage'),

  getVideoAddressAndAuth: post('/dt-tool/api/v1/vod/getUploadAuth'), //获取上传视频凭证（新增）
  refreshUploadVideo: post('/dt-tool/api/v1/vod/refreshUploadVideo'), //获取上传视频凭证（更新）
  getPlayMess: post('/dt-tool/api/v1/vod/getPlayInfo'), // POST获取播放地址

  uploadVideo: server.api().upload('/dt-tool/api/v1/vod/uploadVideo'),
  videoInfo: server.api().post('/dt-tool/api/v1/vod/getPlayInfo').error('no'),
  unloadFile: () => server.api().upload('/dt-tool/api/v1/vod/uploadImage').setTimeout(50000)
}

// //获取上传视频凭证（新增）
// export const getVideoAddressAndAuth = (params = {}) => apiRequestList.$post(
//   '/dt-tool/api/v1/vod/getUploadAuth', params)
// //获取上传视频凭证（更新）
// export const refreshUploadVideo = (params = {}) => apiRequestList.$post(
//   '/dt-tool/api/v1/vod/refreshUploadVideo', params)
// // POST获取播放地址
// export const getPlayMess = (params = {}) => apiRequestList.$post(
//   '/dt-tool/api/v1/vod/getPlayInfo', params)
